<?php
/**
 * Created by PhpStorm.
 * User: 钊鑫
 * Date: 2019/1/24
 * Time: 16:06
 */
namespace app\api\validate;

use app\api\model\Homeuser as HomeuserModel;

class Sms extends Base
{
    protected $rule = [
        'number'    => 'require|mobile|checknumber'
    ];

    protected $message = [
        'number.require'        =>  '手机号不能为空！',
        'number.mobile'         =>  '请输入有效的手机号',
        'number.checknumber'    =>  '该手机号已存在，请重新输入！'
    ];

    //手机号验证
    protected function checknumber($value){
        $result = HomeuserModel::where(['number'=>$value])->count();
        return ($result == 0) ? true : false;
    }

}